﻿<h2>Event Calendar Grouped By Event Type</h2>
@{
  var eventsByType = Model.Children.GroupBy("EventType");

  foreach (var eventGroup in eventsByType)
  {
    <h3>@library.GetPreValueAsString(eventGroup.Key)</h3>
 
    foreach (var node in Model.Children.Where("EventType == " + eventGroup.Key).OrderBy("EventDateTime"))
    {
      <span>NodeName: @node.Name (Node Id: @node.Id)</span><br />
    }
  }
}
<hr />
<h2>Event Calendar In Groups Of 3</h2>
<p>Also shows a truncated summary, which is first stripped of any HTML.</p>
@foreach (var group in Model.Children.OrderBy("EventDateTime").InGroupsOf(3))
{
    @* We're getting the events in groups of 3, which means we 
            can easily surround each group with a div *@
    <div class="column-holder">
    @foreach (var item in group)
    {
        <div class="cell">
            <h3>@item.Name</h3>
            <em>@String.Format("{0:dddd, MMMM d yyyy}", item.eventDateTime) - Starts at @String.Format("{0:HH:mm}", item.eventDateTime)</em><br />
            <span>@(Library.Truncate(Library.StripHtml(item.eventDescription), 200, true))</span>
        </div>
        <p class="readmore-link"><a href="@item.Url" class="link more">read more</a></p>            
    }
    </div>
}